<template>
  <el-row>
    <el-col :span="1"><i class="iconfont icon-zhankaizhedie pointer" @click="is_collapse"></i></el-col>
    <el-col :span="6">{{ user.realName }}</el-col>
    <el-col :span="1" :offset="16"><i title="登出" class="iconfont icon-dengchu pointer" @click="handle_out"></i></el-col>
  </el-row>
</template>

<script>
import { mapGetters } from "vuex";
import { mapActions } from "vuex";

export default {
  computed: {
    ...mapGetters(["user"]),
  },
  methods: {
    ...mapActions(['is_collapse', 'login_out']),

    // 退出登录
    handle_out() {
      this.$confirm('确认退出登录?', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.login_out()
        }).catch(action => {
            
        });
    }
  },
};
</script>

<style lang="scss" scoped>
.el-row {
  .pointer {
    cursor: pointer;
  }

  .icon-dengchu {
    font-size: 26px;
  }
}

</style>